﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace _0812045
{
    public abstract class VisibleGameEntity
    {
        public BaseSprite[] _sprite;
        public int _nsprite;
        private float _x;

        public float x
        {
            get { return _x; }
            set
            {
                _x = value;
                //Cập nhật lại tọa độ x của con Sprite
                for (int i = 0; i < _nsprite; i++)
                {
                    _sprite[i].x = _x;
                }
            }
        }
        private float _y;

        public float y
        {
            get { return _y; }
            set
            {
                _y = value;
                //Cập nhật lại tọa độ y cho các con Sprite
                for (int i = 0; i < _nsprite; i++)
                {
                    _sprite[i].y = _y;
                }
            }
        }

        public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            for (int i = 0; i < _nsprite; i++)
                _sprite[i].Draw(gameTime, spriteBatch);
        }
        public virtual void Update(GameTime gameTime)
        {
            for (int i = 0; i < _nsprite; i++)
                _sprite[i].Update(gameTime);
        }

        public virtual bool Init(ContentManager content, int n, string strResource)
        {
            return false;
        }

        public virtual VisibleGameEntity Clone()
        {
            return null;
        }
    }
}
